﻿@model Core.FrameWork.Models.Models.User.UserSimpleChangeClerk;
@{
    ViewBag.Title = "用户管理";
    Layout = "~/Views/Shared/_LayoutInput.cshtml";
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>详情页面</title>
</head>
<link rel="stylesheet" href="~/admin/css/other/person.css" />
<form class="layui-form" action="">
    <input type="hidden" name="Id" v-model="Id" value="@Model.Id" />
    <body class="pear-container">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md3">
                <div class="layui-card">
                    <div class="layui-card-body" style="padding: 25px;">

                        <div class="text-center layui-text">

                            <div class="user-info-head" id="userInfoHead">
                                <img src="@Model.ImageUrl" id="userAvatar" width="115px" height="115px" alt="">
                                <input type="hidden" id="ImageUrl" name="ImageUrl" v-model="ImageUrl" value="@Model.ImageUrl" />
                            </div>

                            <h2 style="padding-top: 20px;font-size: 20px;">
                                @*<button class="pear-btn pear-btn-primary" id="btImg03" lay-filter="updateImage2222"> 上传图片 </button>*@
                            </h2>
                            @*<p style="padding-top: 8px;margin-top: 10px;font-size: 13.5px;">China ， 中国</p>*@
                        </div>
                    </div>
                    <div style="height: 45px;border-top: 1px whitesmoke solid;text-align: center;line-height: 45px;font-size: 13.5px;">
                        <span>@("提交时间 ："+@Model.CreateTime)</span>
                    </div>
                </div>


                <div class="layui-card">
                    <div class="layui-card-header">
                        其他列表
                    </div>
                    <div class="layui-card-body">
                        @*<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="refreshPwd"><i
                            class="layui-icon
                            layui-icon-refresh"></i></button>*@
                        <ul class="list" id='log'>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="layui-col-md9">
                <div class="layui-card">
                    <div class="layui-card-header">
                        我的信息
                    </div>
                    <div class="layui-card-body">
                        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                            <div class="layui-tab-content">
                                <div class="main-container">

                                    <div class="layui-form-item">
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">用户昵称</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="Name" value="@Model.Name" placeholder=""
                                                       class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">手机号</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="Phone" value="@Model.Phone" placeholder=""
                                                       class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">微信号</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="WeChatAccount" value="@Model.WeChatAccount"
                                                       placeholder="" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">性别</label>
                                            <div class="layui-input-inline">
                                                <select name="Sex" lay-verify="">
                                                    <option value="2">请选择</option>
                                                    @{
                                                        if (Model.Sex == 0)
                                                        {
                                                            <option value="0" selected>男</option>
                                                            <option value="1">女</option>
                                                        }
                                                        else
                                                        {
                                                            <option value="0">男</option>
                                                            <option value="1" selected>女</option>
                                                        }
                                                    }


                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">生日</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="Birthday" value="@Model.Birthday" id="birthday"
                                                       placeholder="yyyy-MM-dd HH:mm:ss" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">星座</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="Constellation" value="@Model.Constellation"
                                                       placeholder="" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">城市</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="City" value="@Model.City" placeholder=""
                                                       class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">有无经验</label>
                                            <div class="layui-input-inline">
                                                <select name="IsUndergo" lay-verify="">
                                                    @{
                                                        if (!Model.IsUndergo)
                                                        {
                                                            <option value="false" selected>无</option>
                                                            <option value="true">有</option>
                                                        }
                                                        else
                                                        {
                                                            <option value="false">无</option>
                                                            <option value="true" selected>有</option>
                                                        }
                                                    }


                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">平台名称</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="PlatformName" value="@Model.PlatformName"
                                                       placeholder="" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">最高单笔金币</label>
                                            <div class="layui-input-inline">
                                                <input type="number" name="MaxMoney" value="@Model.MaxMoney"
                                                       placeholder="" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">最高店员等级</label>
                                            <div class="layui-input-inline">
                                                <input type="number" name="MaxLeaval" value="@Model.MaxLeaval"
                                                       placeholder="" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-inline">
                                            <label class="layui-form-label">是否离职</label>
                                            <div class="layui-input-inline">
                                                <select name="IsLeaveOffice" lay-verify="">
                                                    @{
                                                        if (!Model.IsLeaveOffice)
                                                        {
                                                            <option value="false" selected>未离职</option>
                                                            <option value="true">已离职</option>
                                                        }
                                                        else
                                                        {
                                                            <option value="false">未离职</option>
                                                            <option value="true" selected>已离职</option>
                                                        }
                                                    }


                                                </select>
                                            </div>
                                        </div>
                                           <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                                        </fieldset>
                                        <div class="layui-form-item layui-inline" style="width:1000px">
                                            <label class="layui-form-label">标签</label>
                                            <div class="layui-input-inline">
                                                <div class="layui-btn-container tag" style="width:1000px">
                                                    @{
                                                        var list = new List<string>()
                                                    {
                                                    "tag-item tag-item-normal layui-btn layui-btn-primary layui-btn-sm",
                                                    "tag-item layui-btn layui-btn-primary layui-btn-sm",
                                                    "tag-item tag-item-warm layui-btn layui-btn-primary layui-btn-sm",
                                                    "tag-item tag-item-danger layui-btn layui-btn-primary layui-btn-sm"

                                                    };
                                                        foreach (var item in Model.Tags.Split(';').ToList())
                                                        {
                                                            Random rd = new Random();
                                                            <button lay-id="@item" type="button" class="@list[rd.Next(0, 4)]">
                                                                @item
                                                            </button>
                                                        }
                                                        <input type="hidden" name="Tags" v-model="Tags" value="@Model.Tags" />
                                                    }
                                                </div>

                                            </div>
                                        </div>
                                      <div class="layui-form-item layui-item">
                                            <label class="layui-form-label">简介</label>
                                            <div class="layui-input-inline">
                                                  <textarea placeholder="请输入简介"  name="Introduction" style="width: 842px;"  v-model="Exception" class="layui-textarea">@Model.Introduction</textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </body>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="apply">
                <i class="layui-icon layui-icon-ok"></i>
                通过
            </button>
        </div>
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="save">
                <i class="layui-icon layui-icon-ok"></i>
                保存
            </button>
        </div>

    </div>
</form>
<script>
    layui.use(['jquery', 'element', 'layer', 'convert', 'button', 'form'], function () {
        var element = layui.element,
            layer = layui.layer,
            $ = layui.jquery,
            convert = layui.convert,
            button = layui.button,
            form = layui.form,
            upload = layui.upload,
            laydate = layui.laydate,
            popup = layui.popup;

        laydate.render({
            elem: '#birthday'
            , type: 'datetime'
            , range: false
        });
        //修改申请店员信息
        form.on('submit(save)', function (data) {
            $.ajax({
                    url: 'ApplyUpdate',
                    data: JSON.stringify(data.field),
                    dataType: 'json',
                    contentType: 'application/json',
                    type: 'post',
                success: function (result) {
                    if (result.Code == 200) {
                        layer.msg(result.Msg, {
                            icon: 1,
                            time: 1000
                        }, function () {
                            location.reload();
                        });

                    }
                    else {
                        layer.msg(result.Msg, {
                            icon: 2,
                            time: 1000
                        });
                    }
                }
            })
            return false;
        });

                $("[load]").click(function() {
                    button.load({
                        elem: '[load]',
                        time: 600,
                        done: function() {
                               LoadLog();
                        }
                    })
                })

            window.callback = function (data) {
                layer.close(data.index);
                $("#userAvatar").attr("src", data.newAvatar);
            }

            $("#userAvatar").click(function () {
                layer.open({
                    type: 2,
                    title: '更换图片',
                    shade: 0.1,
                    area: ["900px", "500px"],
                    content: MODULE_PATH + 'profile.html',
                    btn: ['确定', '取消'],
                    yes: function (index, layero) {
                        window['layui-layer-iframe' + index].submitForm();
                    }
                });
            });
        //上传图片
        var uploadInst03 = upload.render({
            elem: '#btImg03'
            , url: UrlBase + 'Upload/Upload'
            , data: { t: 0 }
            , accept: 'images' //指定允许上传时校验的文件类型，可选值有：images（图片）、file（所有文件）、video（视频）、audio（音频）
            , exts: "jpg|png|gif|bmp|jpeg|svg"
            , multiple: false  //是否允许多文件上传
            , number: 1 // 设置同时可上传的文件数量，一般配合 multiple 参数出现。
            , drag: true  //是否接受拖拽的文件上传，设置 false 可禁用。不支持ie8/9
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#userAvatar').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                // console.log(res);
                //如果上传失败
                if (res.Code !=200) {
                    $('#userAvatar').val("");
                    return layer.msg(res.Msg);
                } else {
                    $('#userAvatar').val(res.ResData.FileUrl);
                    $('#ImageUrl').val(res.ResData.FileUrl);
                }
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#img03Text');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs img03-reload">重试</a>');
                demoText.find('.img03-reload').on('click', function () {
                    uploadInst03.upload();
                });
            }
        });
    });
</script>


</html>